define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'share/goodsreward/index' + location.search,
                    import_url: 'share/goodsreward/import',
                    // audit_url: 'share/goodsreward/audit',//添加的字段
                    table: 'shopro_order',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('序号')},
                        {field: 'real_name', title: __('姓名')},
                        {field: 'card_no', title: __('银行卡号')},
                        {field: 'bank_name', title: __('开户行'), operate: 'LIKE'},
                        {field: 'money', title: __('累计收益'), operate:'BETWEEN'},
                        {field: 'month', title: __('月份'), operate:'BETWEEN'},
                        {field: 'addtime', title: __('时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},

                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        audit: function () {
           Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
